package com.travel.controller;

import com.qianfeng.util.ResultMsg;
import com.travel.entity.TbAir;
import com.travel.service.AirService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class AdminAirController {
    @Autowired
    AirService airService;

    @GetMapping("/adminair/findAll")
    public ResultMsg seletAll(@RequestParam(required = false,defaultValue = "1") int current, @RequestParam(required = false,defaultValue = "5") int size) {
        return airService.seletAll(current, size);
    }

    @PostMapping("/adminair/{id}")
    public ResultMsg delete(@PathVariable("id") Integer id){
        return airService.delete(id);
    }

    @PostMapping("/adminair")
    public ResultMsg modify(@RequestBody TbAir tbAir){
        return airService.modify(tbAir);
    }


    @GetMapping("/getAirById/{airId}")
    public ResultMsg getAirById(@PathVariable("airId") int airId){
        return airService.getAirById(airId);
    }
}
